package com.plantplaces.dao;

import java.util.ArrayList;
import java.util.List;

import com.plantplaces.dto.Plant;
import com.plantplaces.dto.PlantSearch;

public class PlantDAOStub implements IPlantDAO {

	@Override
	public List<Plant> fetchPlants(PlantSearch ps) throws Exception {
		// declare our return type.
		List<Plant> allPlants = new ArrayList<Plant>();
		
		if (ps.getCommon().equalsIgnoreCase("Redbud")) {
			// manufacture a redbud plant and return it.
			Plant redbud = new Plant();
			redbud.setGenus("Cercis");
			redbud.setSpecies("canadensis");
			redbud.setCommon("Redbud");
			redbud.setId(83);
			// add the newly created plant to our list.
			allPlants.add(redbud);
			
			
			
		}
		
		if (ps.getCommon().contains("paw")) {
			Plant pawpaw = new Plant();
			pawpaw.setGenus("Asimina");
			pawpaw.setSpecies("triloba");
			pawpaw.setCommon("Common Pawpaw");
			
			pawpaw.setId(82);
			allPlants.add(pawpaw);
		}
		
		return allPlants;
	}

	@Override
	public List<String> fetchPlantNames() throws Exception {
		// declare our return value.
		List<String> allNames = new ArrayList<String>();
		
		allNames.add("Acer saccharum");
		allNames.add("Acer rubruum");
		allNames.add("Acer campestre");
		
		return allNames;
		
	}

}
